Class pyglet.window.ImageMouseCursor

MouseCursor --+
              |
             ImageMouseCursor

A user-defined mouse cursor created from an image.

Use this class to create your own mouse cursors and assign them to windows. There are no constraints on the image size or format.

Methods

  __init__(self, image, hot_x=0, hot_y=0)
Create a mouse cursor from an image.
  draw(self, x, y)
Abstract render method.

Class Variables

  drawable = True

Method Details

__init__

(Constructor) __init__(self, image, hot_x=0, hot_y=0)
Create a mouse cursor from an image.
Parameters:
image : pyglet.image.AbstractImage
Image to use for the mouse cursor. It must have a valid texture attribute.
hot_x : int
X coordinate of the "hot" spot in the image relative to the image's anchor.
hot_y : int
Y coordinate of the "hot" spot in the image, relative to the image's anchor.

draw

draw(self, x, y)

Abstract render method.

The cursor should be drawn with the "hot" spot at the given coordinates. The projection is set to the pyglet default (i.e., orthographic in window-space), however no other aspects of the state can be assumed.

Overrides:
MouseCursor.draw